let audio: HTMLAudioElement | null = null;

export function playAudio(url: string) {
    if (audio) {
        audio.pause(); // 暂停当前音频
        audio = null; // 重置音频对象
    }
    audio = new Audio(url);
    audio.play();
    audio.addEventListener('ended', function () {
        // 音频播放完毕，销毁 Audio 对象
        audio = null;
    });
}